package com.imooc.class15;

import org.springframework.beans.factory.config.CustomScopeConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration
@ComponentScan("com.imooc")
public class TestConfiguration {
//    @Bean("bean1")
//    @Scope("myScope")
//    public TestBean bean1(){
//        return new TestBean();
//    }

    @Bean("myScope")
    public MyScope myScope(){
        return new MyScope();
    }


    @Bean
    public CustomScopeConfigurer customScopeConfigurer(){
        CustomScopeConfigurer customScopeConfigurer=new CustomScopeConfigurer();
        customScopeConfigurer.addScope("myScope",myScope());
        return customScopeConfigurer;
    }
}
